package cn.zhukelili.deepcopy;

import java.util.ArrayList;

/**
 * @Description: 深拷贝
 * @Auther: hongheshou
 * @Date: 2018/7/17 14:23
 */
public class Thing implements Cloneable {
    //定义一个私有变量
    private ArrayList<String> arrayList = new ArrayList<String>();

    @Override
    public Thing clone() {
        Thing thing = null;
        try {
            thing = (Thing) super.clone();
            thing.arrayList = (ArrayList<String>) this.arrayList.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return thing;
    }
}
